package com.jeecms.bbs.manager.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeecms.common.hibernate3.Updater;
import com.jeecms.common.page.Pagination;
import com.jeecms.bbs.dao.BbsForum_testDao;
import com.jeecms.bbs.entity.BbsForum_test;
import com.jeecms.bbs.manager.BbsForum_testMng;

@Service
@Transactional
public class BbsForum_testMngImpl implements BbsForum_testMng {
	@Transactional(readOnly = true)
	public Pagination getPage(int pageNo, int pageSize) {
		Pagination page = dao.getPage(pageNo, pageSize);
		return page;
	}

	@Transactional(readOnly = true)
	public BbsForum_test findById(Long id) {
		BbsForum_test entity = dao.findById(id);
		return entity;
	}

	public BbsForum_test save(BbsForum_test bean) {
		dao.save(bean);
		return bean;
	}

	public BbsForum_test update(BbsForum_test bean) {
		Updater<BbsForum_test> updater = new Updater<BbsForum_test>(bean);
		BbsForum_test entity = dao.updateByUpdater(updater);
		return entity;
	}

	public BbsForum_test deleteById(Long id) {
		BbsForum_test bean = dao.deleteById(id);
		return bean;
	}
	
	public BbsForum_test[] deleteByIds(Long[] ids) {
		BbsForum_test[] beans = new BbsForum_test[ids.length];
		for (int i = 0,len = ids.length; i < len; i++) {
			beans[i] = deleteById(ids[i]);
		}
		return beans;
	}

	private BbsForum_testDao dao;

	@Autowired
	public void setDao(BbsForum_testDao dao) {
		this.dao = dao;
	}
}